package cn.signalpha.modules.shop.entity;

import cn.signalpha.core.swagger.ApiModelPropertyEnum;
import cn.signalpha.modules.pay.enums.PayTypeEnum;
import cn.signalpha.modules.shop.entity.enums.OrderSettleWayEnum;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * 订单结算实体类
 *
 * @author suguangjun
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("shop_order_settle")
@ApiModel(value = "OrderSettle对象", description = "订单结算")
public class OrderSettle implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
	@TableId(value = "id", type = IdType.ASSIGN_ID)
	@JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "用户id")
    private Long userId;

	@ApiModelProperty(value = "商户id")
	private Long sellerId;

	@ApiModelProperty(value = "order表中的订单号")
	private String orderNo;

    @ApiModelProperty(value = "支付单号")
    private String payNo;

	@ApiModelProperty(value = "外部单号")
	private String payBizNo;

    @ApiModelProperty(value = "支付方式")
	@ApiModelPropertyEnum(PayTypeEnum.class)
    private String payType;

	@ApiModelProperty(value = "支付状态")
	private Integer payStatus;

    @ApiModelProperty(value = "支付金额")
    private Double payAmount;

	@ApiModelProperty(value = "服务费比例")
	private Double serveRatio;

	@ApiModelProperty(value = "服务费")
	private Double serveAmount;

	@ApiModelProperty(value = "退款金额")
	private Double refundAmount;

	@ApiModelProperty(value = "结算方式")
	@ApiModelPropertyEnum(OrderSettleWayEnum.class)
	private Integer settleWay;

    @ApiModelProperty(value = "结算金额")
    private Double settleAmount;

    @ApiModelProperty(value = "结算状态：-1结算失败 0未结算 1已结算")
    private Integer settleStatus;

	@ApiModelProperty(value = "结算时间")
	private Date settleTime;

	@ApiModelProperty(value = "结算备注")
	private String settleRemark;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @Version
    @ApiModelProperty(value = "版本号")
    private Integer version;

}
